package com.gitee.ywj1352.template.dao;

import com.gitee.ywj1352.template.JdbcTemplate;
import com.gitee.ywj1352.template.model.Member;

import javax.sql.DataSource;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * 静态代理的 模式
 */
public class MemberDao  {


    private JdbcTemplate jdbcTemplate = new JdbcTemplate(null) ;


    public List<Object> query(){
        String sql = "select * from user";
        return (List<Object>) jdbcTemplate.executeQuery(sql,null,null);
    }

    public Object processResult(ResultSet rs, int rowNum) throws SQLException {
        Member member = new Member();
        member.setUsername(rs.getString("username"));
        member.setUsername(rs.getString("password"));
        member.setUsername(rs.getString("nickName"));
        return member;
    }
}
